package com.xgkj.diyiketang.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.xgkj.diyiketang.R;
import com.xgkj.diyiketang.util.ImageCache;
import com.xgkj.diyiketang.util.zoom.PhotoView;
import com.xgkj.diyiketang.util.zoom.PhotoViewAttacher;

/**
 * Created by XCKJ_Paladowow on 2016/5/9.
 */
public class SingleBigImageActivity extends BaseActivity {
    private Context mContext;
    private PhotoView mPhotoView;
    private String mBigImage;
    private TextView back;
    private PhotoViewAttacher viewAttacher;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.single_big_image);
        mContext = this;
        initView();
    }

    private void initView() {
        back = (TextView) findViewById(R.id.back);
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        Intent intent = getIntent();
        mBigImage = intent.getStringExtra("BIGIMAGE");
        mPhotoView = (PhotoView) findViewById(R.id.image_big);
        mPhotoView.setImageResource(R.drawable.zhanweitu);
        viewAttacher = new PhotoViewAttacher(mPhotoView);
        viewAttacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() {
            @Override
            public void onViewTap(View view, float x, float y) {
                finish();
            }
        });
        // mPhotoView.setImageBitmap();
        ImageCache.getInstance(mContext).loadBitmapToView(mPhotoView, mBigImage, null);

    }
}
